// serverMiddleware/apiProxy.js
const { createProxyMiddleware } = require('http-proxy-middleware');
 
module.exports = function (req, res) {
  return createProxyMiddleware({
    target: 'http://example.com',
    changeOrigin: true,
    pathRewrite: {
      '^/api': '',
    },
  })(req, res);
};